
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<%@ page contentType="text/html; charset=utf-8"%>
	<%@ include file="/commons/taglibs.jsp"%>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>用户密码修改</title>
		<%@ include file="/commons/css_js_head.jsp"%>
<script type="text/javascript">
//复写Url
doUpdateUrl = "${ctx }/permission/efUserAction!doUpdatePW.ts";

function doUpdate(){
   var _form = document.forms[0];
   if(doUpdateUrl == ''){
   	alert('请设置正确的URL!');
   	return false; 
   }
   
   var userPasswordOld = document.getElementById("userPasswordOld");
   var userPasswordNew = document.getElementById("userPasswordNew");
   var userPasswordNewRe = document.getElementById("userPasswordNewRe");
   
   if(userPasswordOld.value == ''){
   	alert('旧密码不能为空');
   	userPasswordOld.focus();
   	return false;
   }
   
   if(userPasswordNew.value == '' || userPasswordNew.value.length < 6){
   	alert('输入新密码不能为空，最少6位，最多12位');
   	userPasswordNew.focus();
   	return false;
   }
   
   if(userPasswordNewRe.value == '' || userPasswordNewRe.value.length < 6){
   	alert('再次输入新密码不能为空，最少6位，最多12位');
   	userPasswordNewRe.focus();
   	return false;
   }   
   
   if(userPasswordNew.value != userPasswordNewRe.value){
    alert('2次密码不一致,请确认');
   	return false;
   }
   
   _form.action = doUpdateUrl;
   _form.submit();
}

//校验数据
$(document).ready(function(){
	
	//$.formValidator.initConfig({formid:"form1",alertmessage:true,onerror:function(msg){alert(msg)},onsuccess:function(){}});
	
	//$("#userPasswordOld").formValidator().inputValidator({min:6,max:12,onerror:"旧密码不能为空，最少6位"});
	//$("#userPasswordNew").formValidator().inputValidator({min:6,max:12,onerror:"输入新密码不能为空，且只能在6-12个字符之间"});
	//$("#userPasswordNewRe").formValidator().inputValidator({min:6,max:12,onerror:"再次输入新密码不能为空，且只能在6-12个汉字之间"}).compareValidator({desid:"userPasswordNew",operateor:"=",onerror:"2次密码不一致,请确认"});

});
</script>
	</head>

<body style="overflow-x: hidden">

<s:form action="/permission/efUserAction" method="post" name="form1" theme="simple" >
<s:hidden name="userId"></s:hidden>
<div class="windowSize510" style="height:180px">
  
  <div class="windowTitle">
    <span class="window_close"><a href="javascript:void(null)" onclick="parent.tb_remove()" title="关闭" ><img src="../images/no.gif" /></a></span>
	<b>用户密码修改</b>
  </div>
  
  <div class="windowMain" style="height:100px;padding-bottom:3px">
	  <table class="addTable" style="height:100px" >
	  <tr>
	    <th width="40%">旧密码：</th>
	    <td width="60%">
	    <s:password name="userPasswordOld" id="userPasswordOld" theme="simple"></s:password>
	    </td>
	  </tr>
	  <tr>
	    <th>请输入新密码：</th>
	    <td><s:password name="userPasswordNew" id="userPasswordNew" theme="simple"></s:password></td>
	  </tr>
	  <tr>
	    <th>再次输入新密码：</th>
	    <td><s:password name="userPasswordNewRe" id="userPasswordNewRe" maxlength="12" theme="simple"></s:password></td>
	  </tr>
	</table>
  </div>
	
	<div class="windowBtn">
	  <a href="javascript:void(null)" onclick="parent.tb_remove()"><span class="btn">取&nbsp;消</span></a>
	  <a href="javascript:void(null)" onclick="doUpdate()"><span class="btn">确&nbsp;定</span></a>
	</div>
  
</div>

</s:form>

<script>
	var pageMsg = '${requestScope.pageMsg}';
	if(pageMsg != null && pageMsg != ''){
		alert(pageMsg);
		parent.tb_remove();
	}
</script>
</body>
</html>
